<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<style>
<!--
.h10{
	height: 10px;
}
-->
.headImg{
	height:5em;
	width:5em;
	border-radius:50%;
	overflow:hidden;
}
</style>
	<div class="m-b-md">
		<div class="h10"></div>
		<form class="form-inline" role="form" id="searchForm" name="searchForm">
			<div class="form-group">
				<label class="control-label">
				<span>昵称:</span></label>
				<input class="form-control" id="nickname" qt="like" name="weixinUserFormMap.nickname">
			</div>
			<div class="form-group">
				<label class="control-label">
				<span>名称:</span></label>
				<input class="form-control" id="name" qt="like" name="weixinUserFormMap.name">
			</div>
			<div class="form-group">
				<label class="control-label">
				<span>手机:</span></label>
				<input class="form-control" id="mobile" qt="like" name="weixinUserFormMap.mobile">
			</div>
			<a href="javascript:void(0)" class="btn btn-default" id="search">查询</a>
			<a href="javascript:grid.exportData('/integral/exportPerson.shtml')" class="btn btn-info" id="search">导出excel</a>
		</form>
	</div>
	<header class="panel-heading">
	<div class="doc-buttons">
		<c:forEach items="${res}" var="key">
			${key.description}
		</c:forEach>
	</div>
	</header>
	<div class="table-responsive">
		<div id="paging" class="pagclass"></div>
	</div>
	
<script type="text/javascript">

var dict = [];
<c:forEach items="${dict }" var="record">
dict.push({'value':'${record.value}','label':'${record.label}'});
</c:forEach>

var pageii = null;
var grid = null;
$(function() {
	grid = lyGrid({
		pagId : 'paging',
		l_column : [ {
			colkey : "openid",
			name : "操作",
			width : "110px",
			renderData : function(rowindex,data, rowdata, column) {
				return "<img class='imgbtn' title='查看' src='" + rootPath + "/images/view.png' onclick=\"viewFun('"+data+"')\"/>&nbsp;&nbsp;&nbsp;&nbsp;"+
						"<img class='imgbtn' title='积分兑换' src='" + rootPath + "/images/exchange.png' onclick=\"buyStore('"+data+"')\"/>";
			}
		}, {
			colkey : "headImgUrl",
			name : "用户头像",
			renderData: function(rowindex,data, rowdata, column) {
				return "<img src="+data+" class='headImg'/>";
			}
		}, {
			colkey : "nickname",
			name : "昵称",
			renderData : function(rowindex,data, rowdata, column) {
				return "<span title='"+data+"'>"+data+"</span>";
			}
		}, {
			colkey : "name",
			name : "姓名",
			renderData : function(rowindex,data, rowdata, column) {
				return "<span title='"+data+"'>"+data+"</span>";
			}
		}, {
			colkey : "sex",
			name : "性别",
			renderData: function(rowindex,data, rowdata, column) {
				if(data==1){
					return "男";
				}else if(data==2){
					return "女";
				}else{
					return "未知";
				}
			}
		}, {
			colkey : "political",
			name : "政治面貌",
			renderData : function(rowindex,data, rowdata, column) {
				var val = "";
				$.each(dict,function(i,e){
					if (e.value == data) {
						val = e.label;
						return false;
					}
				});
				return "<span title='"+val+"'>"+val+"</span>";
			}
		}, {
			colkey : "mobile",
			name : "联系方式",
			renderData : function(rowindex,data, rowdata, column) {
				return "<span title='"+data+"'>"+data+"</span>";
			}
		}, {
			colkey : "email",
			name : "电子邮件",
			renderData : function(rowindex,data, rowdata, column) {
				return "<span title='"+data+"'>"+data+"</span>";
			}
		}, {
			colkey : "integral",
			name : "用户积分"
		}, {
			colkey : "interest",
			name : "兴趣爱好",
			renderData : function(rowindex,data, rowdata, column) {
				return "<span title='"+data+"'>"+data+"</span>";
			}
		}, {
			colkey : "addr",
			name : "地址",
			renderData : function(rowindex,data, rowdata, column) {
				return "<span title='"+data+"'>"+data+"</span>";
			}
		}, {
			colkey : "subscribeTime",
			name : "关注时间",
			renderData : function(rowindex,data, rowdata, column) {
				data = new Date(data).format("yyyy-MM-dd hh:mm:ss");
				return "<span title='"+data+"'>"+data+"</span>";
			}
		}
	],
		jsonUrl : rootPath + '/integral/findPersonalIntegralByPage.shtml',
		checkbox : true
	});
	$("#search").click("click", function() {// 绑定查询按扭
		var searchParams = $("#searchForm").serializeJson();// 初始化传参数
		$("input[qt=like]").each(function() {
			if ($(this).val().trim() != "") {
				searchParams[$(this).attr("name")] = "%" + $(this).val().trim() + "%";
			}
		});
		grid.setOptions({
			data : searchParams
		});
	});
});
function buyStore(cbox){
	alert(cbox);
}
function viewFun(cbox) {
	pageii = layer.open({
		title : "查看",
		type : 2,
		area : [ "900px", "530px" ],
		content : rootPath + '/integral/viewDetail.shtml?id=' + cbox+'&type='+2
	});
}
function buyStore(cbox) {
	pageii = layer.open({
		title : "积分",
		type : 2,
		area : [ "900px", "530px" ],
		content : rootPath + '/integral/viewGood.shtml?id=' + cbox
	});
}
</script>